package com.javalearning;

import java.util.*;
import java.util.stream.IntStream;

public class Yanzhengma {
    public static void main(String[] args) {
        Yanzhengma a1 = new Yanzhengma();
//        System.out.println(a1.yanzhengmaShengcheng(5));
//        System.out.println(a1.averge());
//        int[] nums = new int[]{1, 9, 8, 3};
//        a1.reverSecreted(nums);
//        String result = "";
//        for(int i : nums)
//        {result += i;}
//        System.out.println(result);
//        int[] nums = new int[]{666, 520, 999, 134};
//        System.out.println(a1.copy(nums)[0]);
//        a1.redbag(nums);
//        Scanner sc = new Scanner(System.in);
//        int end = sc.nextInt();
//        List<Integer> resu = new ArrayList<>();
//        int num = 0;
//        for(int i = sc.nextInt();i < end;i++){
//            if(a1.sushu(i)){
//                resu.add(i);
//                num++;
//            }
//        }
//        for(Integer i : resu){
//            System.out.println(i);
//        }
        a1.chengfabiao();
        a1.shuangseqiu();
    }
    public void shuangseqiu(){
        Scanner sc = new Scanner(System.in);
        Random rm = new Random();
        int[] user = new int[7];
        int[] result = new int[7];
        int red = 0;
        int blue;
        for(int i = 0;i < 6;i++){
            user[i] = sc.nextInt();
            result[i] = rm.nextInt(33) + 1;
        }
        Arrays.sort(user, 0, 6);
        Arrays.sort(result, 0, 6);
        int left = 0, right = 0;
        while(left < 6 && right < 6){
            if(user[left] == result[right]){
                red++;
                left++;
                right++;
            }
            else if(user[left] < result[right]){
                left++;
            }
            else{
                right++;
            }
        }
        user[6] = sc.nextInt();
        result[6] = rm.nextInt(16) + 1;
        blue = user[6] == result[6]?1:0;
        switch (red){
            case 0,1:{
                System.out.println("你中了5元");
                break;
            }
            case 2,3:{
                System.out.println("你中了10元");
                break;
            }
            case 4:{
                System.out.println(blue == 1?"你中了200元":"你中了10元");
                break;
            }
            case 5:{
                System.out.println(blue == 1?"你中了3000元":"你中了200元");
                break;
            }
            case 6:{
                System.out.println(blue == 1?"你中了1000万元":"你中了500万元");
                break;
            }
            default:{
                System.out.println("你一毛钱没中");break;
            }
        }
        for(int i : result){
            System.out.printf("%d ", i);
        }
    }
    public void chengfabiao(){
        for(int i = 1;i <= 9;i++){
            for(int k = 1; k <= i;k++){
                System.out.printf("%d * %d = %d ", k, i, k*i);
            }
            System.out.println("");
        }
    }
    public boolean sushu(int num){
        for(int i = 2;i < num/2 ;i++){
            if(num % i == 0){return false;}
        }
        return true;
    }
    public void redbag(int[] nums){
        int redbagnums = nums.length;
        Scanner sc = new Scanner(System.in);
        Random rn = new Random();
        boolean[] visit = new boolean[redbagnums];
        while(redbagnums > 0){
            System.out.println("请输入任意键抢红包");
            sc.nextLine();
            int k = 0;
            do{
                k = rn.nextInt(nums.length);
            }while(visit[k]);
            System.out.println("你抢到了红包：" + nums[k]);
            visit[k] = true;
            redbagnums--;
        }
    }
    public int[] copy(int[] nums){
        int[] result = new int[nums.length];
        for(int i = 0;i < nums.length;i++){
            result[i] = nums[i];
        }
        return result;
    }
    public void reverSecreted(int[] passwd){
        for(int i = 0;i < passwd.length - 2;i++){
            int temp = (passwd[i] + 5) % 10;
            passwd[i] = (passwd[passwd.length - 1 - i] + 5) % 10;
            passwd[passwd.length - 1 - i] = temp;
        }
    }
    public double averge(){
        Scanner sc = new Scanner(System.in);
        int person = sc.nextInt();
        int[] aver = new int[person];
        int sum = 0;
        for(int i = 0;i < person;i++){
            aver[i] = sc.nextInt();
            sum += aver[i];
        }
        int max = aver[0], min = aver[0];
        for(int i = 0;i < person;i++){
            if(min > aver[i]){min = aver[i];}
            if(max < aver[i]){max = aver[i];}

        }
        return (double)(sum - min - max)/(person - 2);

    }
    public String yanzhengmaShengcheng(int len){
        Random rm = new Random();
        String result = "";
        for(int i = 0;i < len;i++){
            int rand = rm.nextInt(3);
            switch (rand){
                case 0:{
                    result += rm.nextInt(10);
                    break;
                }
                case 1:{
                    result +=(char) ('a' + rm.nextInt(26));
                    break;
                }

                case 2:{
                    result +=(char)( 'A' + rm.nextInt(26));break;
                }
            }
        }
        return result;
    }
}
